CREATE TABLE jms_dm.dm_reback_all_detail_dt (
    taking_network_code varchar(64) NULL COMMENT "揽件网点code ",
    apply_network_code varchar(64) NULL COMMENT "登记网点name",
    waybill_no varchar(64) NULL COMMENT "运单号",
    apply_time datetime NULL COMMENT "登记时间",
    examine_time datetime NULL COMMENT "审核时间",
    apply_network_name varchar(128) NULL COMMENT "登记网点name",
    order_source_code varchar(64) NULL COMMENT "订单来源code",
    cod_need tinyint(4) NULL COMMENT "是否需要代收货款1是0否",
    taking_network_name varchar(128) NULL COMMENT "揽件网点名称",
    taking_agent_code varchar(64) NULL COMMENT "揽件代理区code",
    taking_agent_name varchar(64) NULL COMMENT "揽件代理区name",
    taking_time datetime NULL COMMENT "揽收时间",
    dispatch_network_code varchar(64) NULL COMMENT "派件网点code",
    dispatch_network_name varchar(128) NULL COMMENT "派件网点",
    problem_type varchar(128) NULL COMMENT "问题件类型",
    problem_type_code varchar(64) NULL COMMENT "问题件类型code",
    arrival_time datetime NULL COMMENT "到件时间",
    abnormal_type tinyint(4) NULL COMMENT "异常类型(1:不应退回;2:未按要求派送)",
    deliver_cnt int(11) NULL COMMENT "派件次数",
    apply_network_type int(11) NULL COMMENT "登记网点类型（4中心5集散6网点",
    is_reback tinyint(4) NULL COMMENT "揽收明细是否退件1是0否",
    detail_type int(11) NULL COMMENT "明细类型 1退件登记日期2退件申请日期3揽收退件4揽收拦截",
    date_time date NULL COMMENT "查询时间",
    order_source_name varchar(48) NULL COMMENT "订单来源名称",
    dispatch_agent_code varchar(30) NULL COMMENT "派件代理区name",
    dispatch_agent_name varchar(120) NULL COMMENT "派件代理区code",
    dispatch_network_type int(11) NULL COMMENT "派件网点类型 网点类型:1-总部,2-代理区,3-加盟商,4-中心,5-集散点,6-网点",
    taking_network_type int(11) NULL COMMENT "派件网点类型 网点类型:1-总部,2-代理区,3-加盟商,4-中心,5-集散点,6-网点",
    apply_agent_code varchar(30) NULL COMMENT "登记网点所属代理区name",
    apply_agent_name varchar(120) NULL COMMENT "登记网点所属代理区code"
) ENGINE=OLAP 
DUPLICATE KEY(taking_network_code, apply_network_code)
COMMENT "退件率明细"
PARTITION BY RANGE(date_time) ( 
   START ("2023-11-05") END ("2024-01-04") EVERY (INTERVAL 1 day))
DISTRIBUTED BY HASH(site_code) BUCKETS 4
PROPERTIES (
"replication_num" = "3",
"dynamic_partition.enable" = "true",
"dynamic_partition.time_unit" = "DAY",
"dynamic_partition.time_zone" = "Asia/Shanghai",
"dynamic_partition.start" = "-365",
"dynamic_partition.end" = "3",
"dynamic_partition.prefix" = "p",
"dynamic_partition.buckets" = "4",
"in_memory" = "false",
"storage_format" = "V2"
);